package com.myprocessing.box.button;

import com.myprocessing.gui.util.Coord;
import com.myprocessing.gui.util.Polygon;

public class PolygonButton extends Button {
	
	protected Polygon polygon;

	public Polygon getPolygon() {
		return polygon;
	}

	public void setPolygon(Polygon polygon) {
		this.polygon = polygon;
	}
	
	public boolean isValidMouseOver() {
		return polygon.contains(pApplet.mouseX, pApplet.mouseY);		
	}
	
	public void drawBox() {
		pApplet.fill(255, 32);
		pApplet.noStroke();
		pApplet.beginShape();
		for (Coord c : polygon.getCoords()) {
			pApplet.vertex(c.getX(), c.getY());
		}
		pApplet.endShape();
	}
	
}
